#导入APIView
from rest_framework.views import APIView
#导入rest Response
from rest_framework.response import Response
class ArticleDetail(APIView):
    def get(self, request):
        articles = [{"id": 1, "title": "Django for APIs"}]
        return Response(articles, status=200)





class BookList(APIView):
    def get(self, request):
        #打印出get中的请求的数据
        print("打印出request.GET数据：",request.GET)
        print("打印出request.GET数据：",request.GET.get('title'))
        print("打印出request.GET数据：",request.GET)
        #遍历请求的数据
        for key,value in request.GET.items():
            print("打印出key,value数据：",key,value)
        print("打印出request数据：",request)
        books = [{"id": 1, "title": "Django for APIs"}]
        print("打印出books数据：",books)
        return Response(books, status=200)

    def post(APIView):
        books = [{"id": 1, "title": "Django for APIs"}]
        print("打印出books数据：", books)
        return Response(books, status=200)
